<template>
	<view v-if="load_state">
		<view class="eval-lists">
			<eval-list :eval_list = "eval_list"></eval-list>
		<!-- 	<view class="show">
				1111
			</view> -->
		</view>
		
	</view>
	
</template>

<script>
	import evalList from '../../components/goods/eval.vue';
	export default{
		components:{ evalList },
		data(){
			return {
				eval_list : [],
				page : 1,
				last_page : 1,
				goods_id :0,
				load_state : false
			}
		},
		onLoad(e) {
			this.goods_id = e.goods_id;
			this.getData();
		},
		onReachBottom() {
			if(this.page >= this.last_page)return this.toast('暂无更多数据~');
			this.page ++;
			this.getData();
		},
		methods:{
			//获取页面加载数据
			getData(){
				this.ajax('evals/evalList',{
					data:{page : this.page,goods_id : this.goods_id},
					success:(res) =>{
						this.page = res.msg.current_page;
						this.last_page = res.msg.last_page;
						var data = res.msg.data;
						for(var i in data) {
							this.eval_list.push(data[i]);
						}
						this.load_state = true;
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.eval-lists{widows: calc(100% - 40upx);padding: 20upx;}

</style>
